<!doctype html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>

<body>
    <input type="file" onchange="fileChange(event)" placeholder="上传文件" id="flie">
    <img src="" alt="" id="img">
</body>

</html>
<script>
function fileChange(event) {
    let fileList = event.target.files;
    let file = fileList[0];
    console.log(file.name);
    let value = document.getElementById('flie').value;
    let a = value.split("\\").join("/");
    console.log(a );
    document.getElementById('img').src = a;
}
</script>